package club.xyes.zkh.ecommerce.wechat.dto;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;

/**
 * Create by 郭文梁 2019/5/6 0006 09:12
 * WxOauth2AccessTokenResult
 * 微信Oauth2网页授权获取AccessToken
 *
 * @author 郭文梁
 * @data 2019/5/6 0006
 */
@Data
public class WxOauth2AccessTokenResult {
    /**
     * 接口正常时以下字段存在
     */
    @JSONField(name = "access_token")
    private String accessToken;
    @JSONField(name = "expires_in")
    private Integer expiresIn;
    @JSONField(name = "refresh_token")
    private String refreshToken;
    private String openid;
    private String scope;

    /**
     * 发生错误时以下字段存在
     */
    private Integer errcode;
    private String errmsg;

    public boolean isSuccess() {
        return errcode == null
                && openid != null;
    }
}
